#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
int main(int argc, char** argv) {
    LL a,b;
    while (cin>>a>>b) {
        if (a==0 || b==0) break;
        --a;
        if (a%(b+1)!=0) cout<<"Tang"<<endl;
        else cout<<"Jiang"<<endl;
    }
    return 0;
}
